<cfsetting enablecfoutputonly="Yes">

<!--- 
  /**
   * Here we will set up the bare basics for the Mireau application. Session and
   * client management will be turned on and some function and constant files
   * will be included. Also we make sure that all requests get passed through
   * an index.cfm file.
   *
   * @author  <info@mireau.net>
   * @version 1.0 - <yyyy/mm/dd>
   */
--->

<cfscript>
  sForwardingUrl = chr( 0 );

  if( not findNoCase( "index.cfm", cgi.cf_template_path ))
  {
    /*
     * Since we don't have the /lib/app_status.cfm file included yet, we
     * have a hard-coded value that is the same as the variable
     *
     *   * request.status.n_ONLY_INDEXES_PERMITTED
     *
     * that we have defined later on.
     */
     sForwardingUrl = "index.cfm?nStatus=1";
  }
  else if( findNoCase( "www.", cgi.http_host ))
  {
    sForwardingUrl  = "http://"
                    & replaceNoCase( cgi.http_host, "www.", "", "all" )
                    & replaceNoCase( cgi.script_name, "index.cfm", "", "all" );

    if( len( cgi.query_string ))
    {
      sForwardingUrl  = sForwardingUrl & "?" & cgi.query_string;
    }
  }
</cfscript>

<cfif sForwardingUrl neq chr( 0 )>
  <cflocation url="#sForwardingUrl#" addtoken="no">
</cfif>

<cfscript>
  /*
   * Make sure that all the 'standard' scopes are made properly as a structure.
   * This is better when dumping the request scope for example when you are 
   * using CF 5.
   */
  request.udf       = structNew();
  request.site      = structNew();
  request.fusebox   = structNew();
  request.db        = structNew();
  request.status    = structNew();
  request.visitor   = structNew();
  request.dev       = structNew();
</cfscript>

<cfinclude template="./sys/app_udf.cfm">

<cfscript>
  /* 
   * Here we will set the 'anchor' for the application. This is the dir that's
   * the furthest down the road as it can get.
   */
  sAnchorPath = request.udf.pathFormat( getCurrentTemplatePath());
</cfscript>

<cfinclude template="./sys/app_constant.cfm">

<cfapplication
  name="#request.site.s_APPLICATIONNAME#"
  clientmanagement="yes"
  setclientcookies="yes"
  sessionmanagement="yes"
  sessiontimeout="#request.site.d_SESSION_TIMEOUT#"
  applicationtimeout="#request.site.d_APPLICATION_TIMEOUT#"
>

<cfsetting enablecfoutputonly="No">